<template>
<div class="add-project-wrapper">
    <Modal :title="modalTitle"
        v-model="modalShow"
        @on-ok="save"
        @on-cancel="cancel"
        :auto-close="false"
        :mask-closable="false">
        <Form ref="form" :model="graph" :grid="1" :label-width="90" label-position="right">
           <Form-item label="私密性">
                <RadioGroup v-model="graph.access" type="button">
                    <Radio label="private">私密</Radio>
                    <Radio label="public">公开</Radio>
                </RadioGroup>
            </Form-item>
        </Form>
    </Modal>
</div>
</template>

<script>
import util         from 'util'
import getData      from 'getData'
export default {
    data () {
        return {
            graph: {
            },
            modalShow: false,
            modalTitle: '批量私密性设置操作',
            projectList: [],
            idParams:{data:[]},
        }
    },

    methods: {
        cancel() {
            this.$refs.form.resetFields();
            this.modalShow = false;
        },
        save() {
            let that = this;
            that.idParams.str = that.graph.access
            getData.post('saveAccessForGraph',that.idParams).then((res) => {
                if (res.status == 200 && res.data.code == '000') {
                    that.$Message.success('保存私密性设置成功！');
                    that.$emit("refreshGraphList",that.graph.projectId);
                    that.cancel();
                } else {
                    this.$Message.error('保存私密性设置失败！');
                }
            })
        },
        show(projectId,batchGraphIdList) {
            this.idParams.data = batchGraphIdList
            this.graph.projectId = projectId;
            this.modalShow = true;
        },
    }
}
</script>
